<template>
    <div class="table">
        <el-table
        :data="forwardList"
        border
        style="width: 100%">
            <el-table-column
                prop="id"
                label="ID"
                width="180">
            </el-table-column>
            <el-table-column
                prop="create_time"
                label="创建时间"
                width="180">
                <template slot-scope="scope">
                    <div>{{$moment(scope.row.create_time*1000).format('yyyy-MM-DD HH:mm')}}</div>
                </template>
            </el-table-column>
            <el-table-column
                prop="user_id.id"
                label="用户ID">
            </el-table-column>
            <el-table-column
                prop="user_id.username"
                label="用户名">
            </el-table-column>
            <el-table-column
                prop="user_id.avatar.path"
                label="用户头像">
                 <template slot-scope="scope">
                    <img style="width:50px;height:50px;border-radius:50%;" :src="scope.row.user_id.avatar.path" alt="">
                </template>
            </el-table-column>
            <el-table-column
                prop="user_id.phone"
                label="用户电话">
            </el-table-column>
        </el-table>
        <div class="block">
            <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="page"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="pagesize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total">
            </el-pagination>
        </div>
    </div>
</template>

<script>
export default {
    props:{
        informationId:{
            type:String,
            default:''
        }
    },
    data(){
        return{
            page:1,
            pagesize:10,
            total:0,
            forwardList:[]
        }
    },
    methods: {
        // 获取列表
        getForwardList(){
            let params = {
                information_id:this.informationId,
                page:this.page,
                pagesize:this.pagesize
            }
            this.$http.post('/api/root/InformationSupport/index',params).then(res=>{
                console.log(res,'点赞列表');
                if(res.code==1){
                    this.forwardList = res.data.list?res.data.list:[];
                    this.total = res.data.total
                }
            })
        },

        handleSizeChange(val){
            this.pagesize = val
            this.getForwardList()
        },
        handleCurrentChange(val){
            this.page = val
            this.getForwardList()
        }
    },
}
</script>

<style lang="less">
.table{
    padding-bottom: 20px;
    .block{
        display: flex;
        justify-content: flex-end;
        padding-top: 20px;
    }
}
</style>

